package com.cmc6.server.conrtoller;

import com.cmc6.common.util.ApiResult;
import com.cmc6.server.model.vo.ServerInfoVO;
import com.cmc6.server.service.ServerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/server")
@Api(tags = "服务器信息控制器")
public class ServerController {

    @Resource
    ServerService serverService;

    @PreAuthorize("hasAuthority('server:info')")
    @ApiOperation(value = "获取服务器运行情况")
    @PostMapping(value = "/info")
    public ApiResult<ServerInfoVO> info() {
        return ApiResult.ok(serverService.info());
    }

}
